<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>leaves</title>
</head>
<body>
<form action="" method="get">

    <select name="status" id="status">
        {% if status == -1 %}
            <option value="-1" selected>选择类型</option>
        {% else %}
            <option value="-1">选择类型</option>
        {% endif %}


        {% for leave_type in leave_types %}
            {#            根据status 判断 默认选中哪个 标签#}
            {% if leave_type.id == status %}
                <option selected
                        value="{{ leave_type.id }}">{{ leave_type.tname }}--({{ leave_type.leave_set.all.count }})
                </option>
            {% else %}
                <option
                        value="{{ leave_type.id }}">{{ leave_type.tname }}--({{ leave_type.leave_set.all.count }})
                </option>
            {% endif %}

        {% endfor %}

    </select>

    <input type="submit" value="过滤">
</form>
姓名&nbsp;&nbsp;事由&nbsp;&nbsp;状态&nbsp;&nbsp;类型&nbsp;&nbsp;操作
<br>
{% for leaf in leaves %}
    {{ leaf.stu_name }}&nbsp;&nbsp;
    {{ leaf.context }}&nbsp;&nbsp;
    {{ leaf.status }} {{ leaf.get_status_display }}&nbsp;&nbsp;
    {{ leaf.tid.tname }}&nbsp;&nbsp;
    <a href="{% url 'leave:update_leaver' %}?id={{ leaf.id }}&status=1">通过</a>&nbsp;&nbsp;
    <a href="{% url 'leave:update_leaver' %}?id={{ leaf.id }}&status=2">不通过</a>
    <br>
{% endfor %}
<a href="{% url 'leave:show_leaver' %}?page={{ page|add:-1 }}&status={{ status }}">上一页</a> <a href="#">当前页{{ page }}</a>
<a
        href="{% url 'leave:show_leaver' %}?page={{ page|add:1 }}&status={{ status }}">下一页</a>
</body>
</html>